import MyComponent from "../classes/MyComponent.js";
import {MyPCB} from "./MySystem.js";
import {generateElement} from "../functions/common.js";

export class PCB_UI extends MyComponent{
    constructor(myPCB){
        super();
        this.myPCB = null;
        this.elem = generateElement({
            type: "div",
            className: "layui-card",
            width: "100px",
            backgroundColor: "#eeeeee"
        });
        this.header = generateElement({
            type: "div",
            className: "layui-card-header",
        });
        this.body = generateElement({
            type: "div",
            className: "layui-card-body",
        });
        this.elem.appendChild(this.header);
        this.elem.appendChild(this.body);
        if (myPCB instanceof MyPCB){
            this.myPCB = myPCB;
            this.header.innerText = "PCB > " + myPCB.p_id.toString();
            this.body.appendChild(generateElement({
                type: "p",
                innerText: "hhh",
            }));
            this.body.appendChild(generateElement({
                type: "p",
                innerText: "hhh",
            }));
            this.body.appendChild(generateElement({
                type: "p",
                innerText: "hhh",
            }));
            this.body.appendChild(generateElement({
                type: "p",
                innerText: "hhh",
            }));
        }
    }
}